package abd.pr1.Mappers;

import java.sql.ResultSet;
import java.sql.SQLException;

import javax.sql.DataSource;

import abd.pr1.Models.Seguidor;
import abd.pr1.Models.SerieGenero;

public class SeriesGenerosMapper extends AbstractMapper<SerieGenero, ClaveSerieGenero>{

	private static final String[] SERIESGENEROS_KEY_COLUMN_NAMES = new String[] { "id_serie" ,"id_genero"};
	private static final String[] SERIESGENEROS_COLUMN_NAMES = new String[] { "id_serie","id_genero"};
	private static final String SERIESGENEROS_TABLE_NAME = "series_generos";
	
	public SeriesGenerosMapper(DataSource ds) {
		super(ds);
		// TODO Auto-generated constructor stub
	}

	@Override
	protected String getTableName() {
		return SERIESGENEROS_TABLE_NAME;
	}

	@Override
	protected String[] getColumnNames() {
		// TODO Auto-generated method stub
		return SERIESGENEROS_COLUMN_NAMES;
	}

	@Override
	protected Object[] serializeObject(SerieGenero object) {
		// TODO Auto-generated method stub
		return new Object[] { object.getIdSerie(),object.getIdGenero()};
	}

	@Override
	protected String[] getKeyColumnNames() {
		// TODO Auto-generated method stub
		return SERIESGENEROS_KEY_COLUMN_NAMES;
	}

	@Override
	protected Object[] serializeKey(ClaveSerieGenero key) {
		// TODO Auto-generated method stub
		return new Object[] { key.getId_serie(),key.getId_genero() };
	}

	@Override
	protected SerieGenero buildObject(ResultSet rs) throws SQLException {
		Integer id_genero = rs.getInt("id_genero");
		Integer id_serie = rs.getInt("id_serie");
		
		return new SerieGenero(id_serie, id_genero);
	}

	@Override
	protected ClaveSerieGenero getKey(SerieGenero object) {
		// TODO Auto-generated method stub
		return new ClaveSerieGenero(object.getIdSerie(), object.getIdGenero());
	}

	@Override
	protected boolean hasAutoincrementKey() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	void updateKeys(ResultSet rs, SerieGenero object) throws SQLException {
		// TODO Auto-generated method stub
		
	}

}
